

import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.*;

public class FormProva extends JPanel {
    private final JButton botao;
    private final JScrollPane scroll;
    private final ArrayList<FormQuestao> questoes;
    private final JPanel p;
    
    
    public FormProva(ActionListener control) {
        this.setLayout(new BorderLayout());
        
        
        p = new JPanel(new GridLayout(5,1));
        questoes = new ArrayList<FormQuestao>();
        scroll = new JScrollPane(p);
        this.setPreferredSize(new Dimension(100, 300));
        this.add(scroll, BorderLayout.CENTER);
        botao = new JButton("Finalizar.");
        JPanel p2 = new JPanel();
        p2.add(botao);
        this.add(p2, BorderLayout.PAGE_START);
        botao.addActionListener(control);
        
        this.setVisible(true);
    }
    
    public String corrige(int n){
        return questoes.get(n).corrige();
    }
    
    void setQuestao(int n, String q, String an, String bn, String cn, String dn, String en, String resp, String co) {
        questoes.get(n).setQuestao((n+1)+") "+q,an,bn,cn,dn,en,resp,co);
    }
    
    void nova(int i) {
        p.setLayout(new GridLayout(i,1));
        p.removeAll();
        questoes.clear();
        for(int n=0;n<i;n++){
            questoes.add(new FormQuestao((n+1)+") "+"blabalba", "haha", "ops", "lala","ta","baba","e","errou"));
            p.add(questoes.get(n));
        }
        p.repaint();
    }
    
    int getTamanho() {
        return questoes.size();
    }
   
    
    
    
    final static String A = "a";
    final static String B = "b";
    final static String C = "c";
    final static String D = "d";
    final static String E = "e";
}